package eu.webhib.frmwrk.service.intf;

import eu.webhib.frmwrk.domain.intf.BaseEntity;
import eu.webhib.frmwrk.service.utils.RangeData;
import java.util.List;

/**
 * Basic service interface for managing the persistence state of entities
 * @param <T> type of entity managed by this service interface
 */
public interface BaseService<T extends BaseEntity> {

   T createNew();

   void save(T entity);

   T update(T entity);

   void updateFromCopy(T entityToChange, T changedEntity);

   void delete(T entity);

   void deleteAll();

   T findId(Long id);

   List<T> findByNamedQuerySuffix(String namedQueryName, Object... paramValue);

   List<T> findByAttribute(String attrName, Object attrValue);

   T findByAttributeSingle(String attrName, Object attrValue);

   List<T> findAll();

   RangeData<T> findAllRange(int startIndex, int size);

   int count();
}
